 CREATE PROCEDURE [dbo].[sp_Get_AccountWithoutOrder_byDivision]
	@PeroidYear varchar(4), 
	@PeroidMonth varchar(2),
	@Type int,
	@DivisionNum varchar(2)
AS
	select a.Name from 
	(select MdNumber AccountID, MAX(division) DivisionNum, 
	(select FirstName + ' ' + LastName from Accounts where AccountID = z.MdNumber) Name
	from ZipInfo z group by MdNumber) a
	left join dbo.Orders o on a.AccountID = o.AccountID
	and o.PeroidYear = @PeroidYear and o.PeroidMonth = @PeroidMonth
	where (o.OrderID is null or o.IsPurchased = 0)
	and a.DivisionNum=@DivisionNum and a.AccountID not like 'da%'
